
package vista;

import controlador.c_ingrediente;
import javax.swing.JButton;
import javax.swing.JSpinner;
import javax.swing.JTextField;


public class v_ingrediente extends javax.swing.JFrame {

    /** Creates new form v_ingrediente */
    public v_ingrediente() {
        initComponents();
        cancelar();
        c_ingrediente cingrediente = new c_ingrediente(this);
        button_registrar.addActionListener(cingrediente);
    }

     public void cancelar()
    {
    texto_ingrediente.setText("");
    cantidad.setValue(0);
    }

    public JButton getButton_cancelar() {
        return button_cancelar;
    }

    public void setButton_cancelar(JButton button_cancelar) {
        this.button_cancelar = button_cancelar;
    }

    public JButton getButton_registrar() {
        return button_registrar;
    }

    public void setButton_registrar(JButton button_registrar) {
        this.button_registrar = button_registrar;
    }

    public JButton getButton_salir() {
        return button_salir;
    }

    public void setButton_salir(JButton button_salir) {
        this.button_salir = button_salir;
    }

    public JSpinner getCantidad() {
        return cantidad;
    }

    public void setCantidad(JSpinner cantidad) {
        this.cantidad = cantidad;
    }

    public JTextField getTexto_ingrediente() {
        return texto_ingrediente;
    }

    public void setTexto_ingrediente(JTextField texto_ingrediente) {
        this.texto_ingrediente = texto_ingrediente;
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        texto_ingrediente = new javax.swing.JTextField();
        button_registrar = new javax.swing.JButton();
        button_cancelar = new javax.swing.JButton();
        button_salir = new javax.swing.JButton();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        cantidad = new javax.swing.JSpinner();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        getContentPane().setLayout(null);

        jLabel1.setText("Nombre del ingrediente");
        getContentPane().add(jLabel1);
        jLabel1.setBounds(40, 80, 168, 40);
        getContentPane().add(texto_ingrediente);
        texto_ingrediente.setBounds(220, 90, 220, 20);

        button_registrar.setText("Registrar");
        button_registrar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                button_registrarActionPerformed(evt);
            }
        });
        getContentPane().add(button_registrar);
        button_registrar.setBounds(450, 90, 120, 30);

        button_cancelar.setText("Cancelar");
        getContentPane().add(button_cancelar);
        button_cancelar.setBounds(450, 130, 120, 30);

        button_salir.setText("salir");
        getContentPane().add(button_salir);
        button_salir.setBounds(450, 170, 120, 30);

        jLabel2.setText("Registrar ingredientes");
        getContentPane().add(jLabel2);
        jLabel2.setBounds(12, 0, 270, 20);

        jLabel3.setText("cantidad");
        getContentPane().add(jLabel3);
        jLabel3.setBounds(40, 140, 160, 18);
        getContentPane().add(cantidad);
        cantidad.setBounds(220, 130, 70, 30);

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-578)/2, (screenSize.height-290)/2, 578, 290);
    }// </editor-fold>//GEN-END:initComponents

    private void button_registrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_button_registrarActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_button_registrarActionPerformed

    
    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new v_ingrediente().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton button_cancelar;
    private javax.swing.JButton button_registrar;
    private javax.swing.JButton button_salir;
    private javax.swing.JSpinner cantidad;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JTextField texto_ingrediente;
    // End of variables declaration//GEN-END:variables

}
